home *** CD-ROM | disk | other *** search
/ SGI Hot Mix 11 / Hot Mix 11.iso / .all / bin / hotmix11.csh (.txt) < prev    next >
Linux/UNIX/POSIX Shell Script  |  1995-07-16  |  5KB  |  170 lines

  1. #! /bin/csh -f
  2.  
  3. ##########################################################
  4. #
  5. #       Check Operating System version #
  6. #
  7. ##########################################################
  8.  
  9. setenv OSVERSION `/sbin/uname -r`
  10.  
  11. @ ver = `/sbin/uname -r | cut -c1,3`
  12. setenv OSVER $ver
  13.  
  14. if ($ver <= 52 || $ver == 60)  then
  15.         set answer = `$HOTMIXDIR/bin/wrongOS`
  16.         if ($answer == 0) then 
  17.                 echo " "
  18.                 echo "EXITing, Good-Bye"
  19.                 echo " "
  20.                 exit 0
  21.         endif
  22. endif
  23.  
  24. ##########################################################
  25. #
  26. #       Set some envir variables
  27. #
  28. ##########################################################
  29.  
  30. unalias *
  31.  
  32. setenv ROOTDIRECTORY `pwd`
  33. setenv HOTMIXDIR $ROOTDIRECTORY/.all
  34.  
  35. ##########################################################
  36. #
  37. #      NEED to find a writeable tmp directory
  38. #
  39. ##########################################################
  40.  
  41.         if (-w /usr/tmp) then
  42.            setenv TMPFILEDIR "/usr/tmp"
  43.         else if (-w /tmp) then
  44.            setenv TMPFILEDIR "/tmp"
  45.         else if (-w $HOME) then
  46.            setenv TMPFILEDIR $HOME
  47.         endif
  48.  
  49. if (-e $TMPFILEDIR/showmess && -x $TMPFILEDIR/showmess) then
  50.     setenv SHOWMESS $TMPFILEDIR/showmess
  51. else
  52.     if (-e $TMPFILEDIR/showmess && ! -w $TMPFILEDIR/showmess) then
  53. echo Using CD version
  54.         setenv SHOWMESS $HOTMIXDIR/bin/showmess
  55.     else
  56.         cp $HOTMIXDIR/bin/showmess $TMPFILEDIR
  57.         setenv SHOWMESS $TMPFILEDIR/showmess
  58.     endif
  59. endif
  60.  
  61. setenv TMPFILE $TMPFILEDIR/.HM11_`date $* | sed -e 's/ //g'`
  62. setenv HM11LOG $TMPFILEDIR/HM11LOGFILE.`date $* | sed -e 's/ //g'`
  63.  
  64. #--------------------------------
  65. #   write header to tmpfile
  66. #--------------------------------
  67. echo '\n'      >> $TMPFILE
  68. echo 'MeFr:\c' >> $TMPFILE
  69. #--------------------------------
  70.  
  71.  
  72. echo `date` > $HM11LOG
  73. echo "=============================================" >> $HM11LOG
  74. echo " " >> $HM11LOG
  75. touch $TMPFILE
  76. echo TMPFILEDIR=$TMPFILEDIR >> $HM11LOG
  77.  
  78. echo OSVERSION=$OSVERSION >> $HM11LOG
  79.  
  80. set path=($path /usr/bin/X11 /usr/sbin . $TMPFILEDIR $HOTMIXDIR/bin)
  81. echo "Setting path=$PATH" >> $HM11LOG
  82.  
  83. ##########################################################
  84.  
  85. if ( ! ${?XUSERFILESEARCHPATH} ) then
  86.       echo XUSERFILESEARCHPATH is not set, setting it to $HOME >> $HM11LOG
  87.       setenv XUSERFILESEARCHPATH "$HOME/%N"
  88.   else
  89.       echo adding $HOME to XUSERFILESEARCHPATH  >> $HM11LOG
  90.       setenv XUSERFILESEARCHPATH "${XUSERFILESEARCHPATH}:$HOME/%N"
  91.   endif
  92.  
  93.   if ( ! ${?XFILESEARCHPATH} ) then
  94.       echo XFILESEARCHPATH is not set, setting it to $HOME >> $HM11LOG
  95.       setenv XFILESEARCHPATH "$HOME/%N"
  96.   else
  97.       echo adding $HOME to XFILESEARCHPATH >> $HM11LOG
  98.       setenv XFILESEARCHPATH "${XFILESEARCHPATH}:$HOME/%N"
  99.   endif
  100.   
  101. ##########################################################
  102. #
  103. #       Set environ for netscape
  104. #
  105. ##########################################################
  106.  
  107. if (-w $HOME) then
  108.         if (-e "$HOME/.netscape-preferences") then
  109.                 $HOTMIXDIR/bin/nawk -f $HOTMIXDIR/bin/awkzilla.awk \
  110.                        $HOME/.netscape-preferences \
  111.                      > $HOME/.netscape-preferehm11
  112.         else
  113.                 cp $HOTMIXDIR/demos/netscape/.netscape-preferehm11  $HOME
  114.         endif
  115. else 
  116.     /usr/bin/X11/xconfirm -icon warning \
  117.         -t "Cannot Write to the $HOME directory" \
  118.         -t " " \
  119.         -t "You need to have write permissions for your home directory\!" \
  120.         -t "This will end this session of Hot Mix...." \
  121.         -t " " \
  122.         -b Ok
  123.         exit 
  124. endif
  125.  
  126. cd $HOTMIXDIR/demos/netscape 
  127.  
  128. ./netscape.hm11 -geometry =800x940 -xrm "*strings.7230:This process will either Install, Remove, or Launch\nsoftware from the Hot Mix 11 CD.\n\nProceed?\n" file:$ROOTDIRECTORY/.all/intro.html 
  129.  
  130. ##########################################################
  131. #
  132. #       Start Email reply card 
  133. #
  134. ##########################################################
  135.  
  136. if (-e $TMPFILEDIR/.hm11lock) then
  137.  
  138.        setenv resend `xconfirm -c -t 'Someone on this machine has already registered' -t 'for the Hot Mix 11 Contest.' -t ' ' -t 'Do you want to register again?' -icon info -b No -B Yes`
  139.  
  140.         switch ($resend)
  141.              case Yes:
  142.                     cd $HOTMIXDIR/bin
  143.                     $HOTMIXDIR/bin/Email.online
  144.                     breaksw
  145.              case No:
  146.                     breaksw
  147.         endsw
  148. else
  149.         cd $HOTMIXDIR/bin
  150.         $HOTMIXDIR/bin/Email.online
  151. endif
  152.  
  153. ##########################################################
  154. #
  155. #       Clean up
  156. #
  157. ##########################################################
  158. CLEANUP:
  159. if ( -e $TMPFILE && -w $TMPFILE) then
  160.         \rm -rf $TMPFILE
  161. endif
  162.  
  163. if ( -e $HM11LOG && -w $HM11LOG) then
  164.         \rm -rf $HM11LOG
  165. endif
  166.  
  167.  
  168. exit
  169.  
  170.